package com.example.onlinetaxi.BaiDuMap;

import android.app.Activity;
import android.os.Handler;

import com.baidu.mapapi.search.geocode.GeoCoder;

// 用来管理GeoCoder
public class MyGeoCoder {
    public static MyGeoCoder myGeoCoder = new MyGeoCoder();

    public GeoCoder mGeoCoder = null;
    public Handler mHandler;

    private MyGeoCoder() {

    }

    // 用来初始化handler
    public void setActivity(Activity activity){
        mHandler = new Handler(activity.getMainLooper());
    }

    public void destroy() {
        if (null != mHandler) {
            mHandler.removeCallbacksAndMessages(null);
        }

        if (null != mGeoCoder) {
            mGeoCoder.destroy();
        }
    }
}
